<template>
    <div class="layout">
        <Layout style="background:#fff">
            <Header style="background:#fff">
                <Menu mode="horizontal" theme="dark" active-name="1" style="background:#fff">
                    <div class="layout-logo"><img src="https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3568224500,4262205115&fm=26&gp=0.jpg" alt=""></div>
                    <div class="layout-nav">
                        <Dropdown>
        <a href="javascript:void(0)">
            {{userInfo.user_name}}
            <Icon type="ios-arrow-down"></Icon>
        </a>
        <DropdownMenu slot="list" >
            <DropdownItem>
                <span  @click="loginOut">退出登录</span>
                </DropdownItem>
        </DropdownMenu>
    </Dropdown>
                    </div>
                </Menu>
            </Header>
            <Layout>
                <Sider hide-trigger className="se">
                    <Menu active-name="1-2" theme="light" width="auto" :open-names="['1']" >
                        <Submenu name="1" >
                            <template slot="title">
                                <Icon type="ios-navigate"></Icon>
                                Item 1
                            </template>
                            <MenuItem name="1-1">Option 1</MenuItem>
                            <MenuItem name="1-2">Option 2</MenuItem>
                            <MenuItem name="1-3">Option 3</MenuItem>
                        </Submenu>
                        <Submenu name="2">
                            <template slot="title">
                                <Icon type="ios-keypad"></Icon>
                                Item 2
                            </template>
                            <MenuItem name="2-1">Option 1</MenuItem>
                            <MenuItem name="2-2">Option 2</MenuItem>
                        </Submenu>
                        <Submenu name="3">
                            <template slot="title">
                                <Icon type="ios-analytics"></Icon>
                                Item 3
                            </template>
                            <MenuItem name="3-1">Option 1</MenuItem>
                            <MenuItem name="3-2">Option 2</MenuItem>
                        </Submenu>
                    </Menu>
                </Sider>
                <Layout :style="{padding: '0 24px 24px'}">
                    <Breadcrumb :style="{margin: '24px 0'}">
                        <BreadcrumbItem>Home</BreadcrumbItem>
                        <BreadcrumbItem>Components</BreadcrumbItem>
                        <BreadcrumbItem>Layout</BreadcrumbItem>
                    </Breadcrumb>
                    <Content :style="{padding: '24px', minHeight: '280px', background: '#fff'}">
                        Content
                    </Content>
                </Layout>
            </Layout>
        </Layout>
    </div>
</template>
<script>
import Cookies from 'js-cookie'
    export default {
        data(){
          return{
            userInfo:JSON.parse(sessionStorage.getItem('userInfo'))
          }
        },
        methods:{
            loginOut(){
                sessionStorage.removeItem('userInfo')
                Cookies.remove('token')
                this.$router.push('/login')
            }
        }
    }
</script>

<style scoped>
.layout{
    border: 1px solid #d7dde4;
    background: #f5f7f9;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}
.layout-logo{
    width: 100px;
    height: 30px;
    background: #5b6270;
    border-radius: 3px;
    float: left;
    position: relative;
    top: 15px;
    left: 20px;
}
.layout-nav{
    width: 420px;
    margin: 0 auto;
    margin-right: 20px;
}
.layout-logo img{
  width: 100%;
  height: 100%;
}
.se{
    background:rgb(255, 255, 255)
}
</style>